<?php
/* 
    Project     : 48c6c450f1a4a0cc53d9585dc0fee742
    Created on  : Mar 16, 2013, 11:29:15 PM
    Author      : Truong Khuong - khuongxuantruong@gmail.com
    Description :
        Purpose of the stylesheet follows.
*/
class data_model extends CI_Model {

    function __construct()
    {
        parent::__construct();
		$this->limit=11;
    }
    function gets_by_type($type="feature",$start=0,$limit=9){
        $query=$this->db
				->select(" SQL_CALC_FOUND_ROWS * ",false)
                ->where('data_type',$type)
                ->order_by('data_insert', 'DESC')
				->limit($limit,$start)
                ->get('data');
        //return $query->result();
		$rows = $query->result();
        $sql = "SELECT FOUND_ROWS() AS `found_rows`;";
        $query = $this->db->query($sql);
        $tmp = $query->row_array();
        $total_rows = $tmp['found_rows'];
		return array(
			'rows'=>$rows,
			'total_rows'=>$total_rows
		);
    }
    
}
